package cn.kgc.mushroomwebui.controller;

import cn.kgc.mushroomcommon.api.ManagerRemoteService;
import cn.kgc.mushroomcommon.pojo.Address;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/address/manager")
public class AddressController {
    @Resource
    ManagerRemoteService managerRemoteService;


    @RequestMapping("/query/address/view/list/by/uid")
    public List<Address> selectAddressListByView(@RequestParam(value = "uidaddress",defaultValue = "0") Integer uidaddress){
        return managerRemoteService.selectAddressListByView(uidaddress);
    }

    @RequestMapping("/insertaddress")
    public Map<String,Object> insertaddress(@RequestBody Address address){
        Map<String, Object> insertaddress = managerRemoteService.insertaddress(address);
        return insertaddress;
    }

    @RequestMapping("/deleteaddress")
    public Map<String,Object> deleteaddress(@RequestParam("id")Integer id){
        Map<String, Object> deleteaddress = managerRemoteService.deleteaddress(id);
        return deleteaddress;
    }

    @RequestMapping("/updateaddress")
    public Map<String,Object> updateaddress(@RequestParam("id")Integer id){
        Map<String, Object> updateaddress = managerRemoteService.updateaddress(id);
        return updateaddress;
    }

    @RequestMapping("selectByStatus")
    public Address selectByStatus(@RequestParam("status")Integer status){
        Address address = managerRemoteService.selectByStatus(status);
        return address;
    }

    @RequestMapping("/updatemoren")
    public Map<String,Object> updatemoren(@RequestParam("id")Integer id){
        Map<String, Object> updatemoren = managerRemoteService.updatemoren(id);
        return updatemoren;
    }

}
